import axios from './axios'
import resfulParamsToUrl from './resfulParamsToUrl'
// APP菜单添加
export const appMenuInsert = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tAppMenu/insert', params), params)
		.catch(() => {})
}

// APP菜单查询
export const getAppMenuList = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tAppMenu/getList', params), params)
		.catch(() => {})
}

// APP菜单树形查询
export const getAllAppMenuList = params => {
	axios.prototype._loading_ = false
	return axios
		.post(resfulParamsToUrl('/sys/auth/tAppMenu/getAllList', params), params)
		.catch(() => {})
}

// APP菜单删除
export const deleteAppMenu = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tAppMenu/delete', params), params)
		.catch(() => {})
}

// APP菜单修改
export const updateAppMenu = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tAppMenu/update', params), params)
		.catch(() => {})
}
// APP菜单按钮
export const appButtonSave = params => {
	return axios
		.post(resfulParamsToUrl('/sys/auth/tAppMenu/buttonSave', params), params)
		.catch(() => {})
}
// APP菜单机构关系添加
export const orgAppMenuSave = params => {
	axios.prototype._loading_ = false
	return axios
		.post(resfulParamsToUrl('/sys/auth/tOrgAppMenu/insert', params), params)
		.catch(() => {})
}
// 根据机构查看APP菜单
export const getOrgAppMenuList = params => {
	axios.prototype._loading_ = false
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/tOrgAppMenu/getOrgMenuList', params),
			params,
		)
		.catch(() => {})
}

// 关联表单权限表的查询(用于权限分配)
export const getFormAppMenuList = params => {
	axios.prototype._loading_ = false
	return axios
		.post(
			resfulParamsToUrl(
				'/sys/auth/tCustomerFormAppmenu/getFormAppMenuList',
				params,
			),
			params,
		)
		.catch(() => {})
}

// 保存表单和菜单的关系
export const saveTCustomerFormAppmenu = params => {
	axios.prototype._loading_ = false
	return axios
		.post(
			resfulParamsToUrl('/sys/auth/tCustomerFormAppmenu/insert', params),
			params,
		)
		.catch(() => {})
}
